package com.leancloud.home.adapter;

import android.view.View;
import android.widget.ImageView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.leancloud.home.R;
import com.leancloud.home.activity.ApplyActivity;
import com.leancloud.home.activity.RedemptionActivity;
import com.leancloud.home.activity.SubscriptionActivity;
import com.leancloud.home.entity.ComputingEntity;

import tech.com.commoncore.manager.GlideManager;
import tech.com.commoncore.utils.FastUtil;
import tech.com.commoncore.utils.OnNoDoubleClickListener;

public class HomeHotAdapter extends BaseQuickAdapter<ComputingEntity, BaseViewHolder> {



    public HomeHotAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(final BaseViewHolder helper, ComputingEntity item) {
        ImageView iv = (ImageView) helper.getView(R.id.img_icon);
        if (item.getIcon() == R.mipmap.home_b_1){
            GlideManager.loadImg(R.mipmap.home_b_1, iv, R.mipmap.home_b_1);
        }else if (item.getIcon() == R.mipmap.hone_b_2){
            GlideManager.loadImg(R.mipmap.hone_b_2, iv, R.mipmap.hone_b_2);
        }else if (item.getIcon() == R.mipmap.hone_b_3){
            GlideManager.loadImg(R.mipmap.hone_b_3, iv, R.mipmap.hone_b_3);
        }
//        else if (item.getIcon() == R.mipmap.hone_b_4){
//            GlideManager.loadImg(R.mipmap.hone_b_4, iv, R.mipmap.hone_b_4);
//        }else if (item.getIcon() == R.mipmap.hone_b_5){
//            GlideManager.loadImg(R.mipmap.hone_b_5, iv, R.mipmap.hone_b_5);
//        }
        else if (item.getIcon() == R.mipmap.hone_b_6){
            GlideManager.loadImg(R.mipmap.hone_b_6, iv, R.mipmap.hone_b_6);
        }

//        helper.setText(R.id.tv_title,item.getTitle());
//        helper.setText(R.id.tv_msg,item.getMsg());

        helper.itemView.setOnClickListener(new OnNoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                if (helper.getPosition() == 0){
                    //比特币
                    ARouter.getInstance().build("/zixun/netease").navigation();
                }else if (helper.getPosition() == 1){
                    //基本技术
                    ARouter.getInstance().build("/zixun/jb").navigation();
                }else if (helper.getPosition() == 5){
                    //区块链
                    ARouter.getInstance().build("/zixun/qkl").navigation();
                }else if (helper.getPosition() == 2){
                    //衍生技术
                    ARouter.getInstance().build("/zixun/ys").navigation();
                }else {

                }
            }
        });

    }
}
